(global.webpackJsonp = global.webpackJsonp || []).push([ [ "components/shopro-sku/shopro-sku" ], {
    "23f0": function(t, n, r) {
        r.d(n, "b", function() {
            return o;
        }), r.d(n, "c", function() {
            return u;
        }), r.d(n, "a", function() {
            return e;
        });
        var e = {
            uniNumberBox: function() {
                return r.e("components/uni-number-box/uni-number-box").then(r.bind(null, "be69"));
            }
        }, o = function() {
            this.$createElement;
            this._self._c;
        }, u = [];
    },
    "49d3": function(t, n, r) {},
    a743: function(t, n, r) {
        r.r(n);
        var e, o = r("23f0"), u = r("fe050");
        for (e in u) "default" !== e && function(t) {
            r.d(n, t, function() {
                return u[t];
            });
        }(e);
        r("b79c");
        var i = r("f0c5"), o = Object(i.a)(u.default, o.b, o.c, !1, null, null, null, !1, o.a, void 0);
        n.default = o.exports;
    },
    b1b0: function(t, n, r) {
        Object.defineProperty(n, "__esModule", {
            value: !0
        }), n.default = void 0;
        var e = r("26cb");
        function h(t, n) {
            var r;
            if ("undefined" == typeof Symbol || null == t[Symbol.iterator]) {
                if (Array.isArray(t) || (r = function(t, n) {
                    if (t) {
                        if ("string" == typeof t) return c(t, n);
                        var r = Object.prototype.toString.call(t).slice(8, -1);
                        return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? c(t, n) : void 0;
                    }
                }(t)) || n && t && "number" == typeof t.length) {
                    r && (t = r);
                    var e = 0, n = function() {};
                    return {
                        s: n,
                        n: function() {
                            return e >= t.length ? {
                                done: !0
                            } : {
                                done: !1,
                                value: t[e++]
                            };
                        },
                        e: function(t) {
                            throw t;
                        },
                        f: n
                    };
                }
                throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
            }
            var o, u = !0, i = !1;
            return {
                s: function() {
                    r = t[Symbol.iterator]();
                },
                n: function() {
                    var t = r.next();
                    return u = t.done, t;
                },
                e: function(t) {
                    i = !0, o = t;
                },
                f: function() {
                    try {
                        u || null == r.return || r.return();
                    } finally {
                        if (i) throw o;
                    }
                }
            };
        }
        function c(t, n) {
            (null == n || n > t.length) && (n = t.length);
            for (var r = 0, e = new Array(n); r < n; r++) e[r] = t[r];
            return e;
        }
        function u(n, t) {
            var r, e = Object.keys(n);
            return Object.getOwnPropertySymbols && (r = Object.getOwnPropertySymbols(n), t && (r = r.filter(function(t) {
                return Object.getOwnPropertyDescriptor(n, t).enumerable;
            })), e.push.apply(e, r)), e;
        }
        function o(e) {
            for (var t = 1; t < arguments.length; t++) {
                var o = null != arguments[t] ? arguments[t] : {};
                t % 2 ? u(Object(o), !0).forEach(function(t) {
                    var n, r;
                    n = e, t = o[r = t], r in n ? Object.defineProperty(n, r, {
                        value: t,
                        enumerable: !0,
                        configurable: !0,
                        writable: !0
                    }) : n[r] = t;
                }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(o)) : u(Object(o)).forEach(function(t) {
                    Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(o, t));
                });
            }
            return e;
        }
        e = {
            name: "shoproSku",
            components: {
                uniNumberBox: function() {
                    r.e("components/uni-number-box/uni-number-box").then(function() {
                        return resolve(r("be69"));
                    }.bind(null, r)).catch(r.oe);
                }
            },
            data: function() {
                return {
                    skuList: [],
                    currentSkuPrice: {
                        id: 0
                    },
                    currentSkuArray: [],
                    goodsNum: 1,
                    confirmgoods: {},
                    type: this.buyType
                };
            },
            props: {
                goods: {},
                value: {},
                buyType: {
                    type: String,
                    default: "sku"
                },
                goodsType: {
                    type: String,
                    default: "goods"
                },
                grouponBuyType: {
                    type: String,
                    default: "alone"
                },
                grouponId: {
                    type: Number,
                    default: 0
                }
            },
            created: function() {
                this.skuList = this.goods.sku, this.changeDisabled(!1);
            },
            mounted: function() {},
            watch: {
                type: function(t, n) {
                    return newVal;
                }
            },
            computed: {
                skuPrice: function() {
                    return this.goods.sku_price;
                },
                showModal: {
                    get: function() {
                        return this.value;
                    },
                    set: function(t) {
                        this.$emit("input", t);
                    }
                },
                currentSkuText: function() {
                    var t = this, r = "";
                    return this.currentSkuArray.forEach(function(n) {
                        t.skuList.forEach(function(t) {
                            t.content.forEach(function(t) {
                                t.id === n && (r += "  " + t.value);
                            });
                        });
                    }), t.$emit("getSkuText", r), r;
                }
            },
            methods: o(o({}, (0, e.mapActions)([ "addCartGoods", "getCartList" ])), {}, {
                jump: function(t, n) {
                    this.$Router.push({
                        path: t,
                        query: n
                    });
                },
                chooseSku: function(t, n) {
                    var r = this;
                    null != r.currentSkuArray[t] && r.currentSkuArray[t] == n ? r.currentSkuArray.splice(t, 1, "") : r.$set(r.currentSkuArray, t, n);
                    var e = [];
                    r.currentSkuArray.forEach(function(t) {
                        "" != t && e.push(t);
                    });
                    n = this.getCanUseSkuPrice();
                    e.length == r.skuList.length && n.length ? r.currentSkuPrice = n[0] : r.currentSkuPrice = {};
                },
                changeDisabled: function() {
                    var t = 0 < arguments.length && void 0 !== arguments[0] && arguments[0], n = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 0, r = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : 0, e = [];
                    if (t) {
                        var o = h(this.skuPrice);
                        try {
                            for (o.s(); !(u = o.n()).done; ) {
                                var u = u.value;
                                u.stock <= 0 || 0 <= u.goods_sku_id_arr.indexOf(r.toString()) && e.push(u);
                            }
                        } catch (t) {
                            o.e(t);
                        } finally {
                            o.f();
                        }
                    } else e = this.getCanUseSkuPrice();
                    var i, c = [], s = h(e);
                    try {
                        for (s.s(); !(a = s.n()).done; ) var a = a.value, c = c.concat(a.sku_id_arr);
                    } catch (t) {
                        s.e(t);
                    } finally {
                        s.f();
                    }
                    c = Array.from(new Set(c)), t ? (i = c.indexOf(r.toString()), c.splice(i, 1)) : this.currentSkuArray.forEach(function(t) {
                        "" == t.toString() || 0 <= (t = c.indexOf(t.toString())) && c.splice(t, 1);
                    });
                    var f, d = [];
                    for (f in t ? d = [ n ] : this.currentSkuArray.forEach(function(t, n) {
                        "" != t && d.push(n);
                    }), this.skuList) if (!(0 <= d.indexOf(this.skuList[f].id))) for (var l in this.skuList[f].content) 0 <= c.indexOf(this.skuList[f].content[l].id.toString()) ? this.skuList[f].content[l].disabled = !1 : this.skuList[f].content[l].disabled = !0;
                },
                getCanUseSkuPrice: function() {
                    var t, e = this, o = [], n = h(this.skuPrice);
                    try {
                        for (n.s(); !(t = n.n()).done; ) !function() {
                            var n, r = t.value;
                            r.stock <= 0 || (n = !0, console.info(e.currentSkuArray), e.currentSkuArray.forEach(function(t) {
                                "" != t.toString() && r.sku_id_arr.indexOf(t.toString()) < 0 && (n = !1);
                            }), n && o.push(r));
                        }();
                    } catch (t) {
                        n.e(t);
                    } finally {
                        n.f();
                    }
                    return o;
                },
                changeNum: function(t) {
                    this.goodsNum = +t, this.changeDisabled(!1);
                },
                showSkuModal: function() {
                    this.$emit("changeType", "sku"), this.showModal = !0;
                },
                hideModal: function() {
                    this.showModal = !1;
                },
                confirmCart: function() {
                    var n = this, t = n.currentSkuPrice.id || 0;
                    this.confirmSku() && (t = {
                        goods_id: n.goods.id,
                        spec_id: t,
                        count: n.goodsNum,
                        from: "goods"
                    }, n.addCartGoods(t).then(function(t) {
                        1 === t.errno && n.$tools.toast(t.msg);
                    }));
                },
                confirmBuy: function() {
                    var t, n = this, r = n.currentSkuPrice.id || 0;
                    this.confirmSku() && (t = [], r = {
                        goods_id: n.goods.id,
                        spec_id: r,
                        count: n.goodsNum
                    }, t.push(r), n.jump("/pages/order/confirm", {
                        goodsList: JSON.stringify(t),
                        from: "goods",
                        orderType: n.goodsType
                    }));
                },
                confirm: function() {
                    switch (1 == this.goods.is_sku && this.confirmSku(), this.buyType) {
                      case "cart":
                        this.confirmCart();
                        break;

                      case "buy":
                        this.confirmBuy();
                    }
                },
                confirmSku: function() {
                    var t = this;
                    return t.currentSkuPrice.stock < t.goodsNum ? (t.$tools.toast("库存不足"), !1) : (t.currentSkuPrice.goods_num = t.goodsNum, 
                    t.confirmgoods = {
                        goods_id: t.currentSkuPrice.goods_id,
                        goods_num: t.currentSkuPrice.goods_num,
                        sku_price_id: t.currentSkuPrice.id,
                        goods_price: t.currentSkuPrice.price
                    }, t.confirmgoods.sku_price_id ? !(t.showModal = !1) : (t.$tools.toast("请选择规格"), 
                    !1));
                }
            })
        };
        n.default = e;
    },
    b79c: function(t, n, r) {
        var e = r("49d3");
        r.n(e).a;
    },
    fe050: function(t, n, r) {
        r.r(n);
        var e, o = r("b1b0"), u = r.n(o);
        for (e in o) "default" !== e && function(t) {
            r.d(n, t, function() {
                return o[t];
            });
        }(e);
        n.default = u.a;
    }
} ]), (global.webpackJsonp = global.webpackJsonp || []).push([ "components/shopro-sku/shopro-sku-create-component", {
    "components/shopro-sku/shopro-sku-create-component": function(t, n, r) {
        r("543d").createComponent(r("a743"));
    }
}, [ [ "components/shopro-sku/shopro-sku-create-component" ] ] ]);